﻿#region Using

using System;
using System.Xml.Serialization;

using Menu.Common;
using Menu.Components;

using GlobalServices = GameCommon.Services.Service;
#endregion

namespace Menu.XmlEntities
{
    [Serializable]
    public class XmlTextInput : XmlText
    {
        [XmlAttribute("Length")]
        public int Length { get; set; }

        [XmlAttribute("InputX")]
        public int InputX { get; set; }

        internal override MenuComponentBase GetComponent(MenuComponentBase parent)
        {
            var comp = new TextInput(this.Id, (Text)base.GetComponent(parent), this.FontEnum, this.FontSize);
            comp.Length = this.Length;
            comp.InputX = this.InputX;
            comp.InputController = new InputController();
            comp.HitBox = GlobalServices.ComponentModifier.GetTextHitBox(comp, this.Command);

            return comp;
        }
    }
}